package yjh.util;

import java.util.HashMap;
import java.util.Map;

public class ResultData {

    public static Map ok(){
        Map<String,Object> m = new HashMap();

        m.put("code",200);
        m.put("status","success");
        m.put("data",null);

        return m;
    }

    public static Map ok(Object data){
        Map<String,Object> m = new HashMap();

        m.put("code",200);
        m.put("status","success");
        m.put("data",data);

        return m;
    }

    public static Map fail(int code,String message){
        Map<String,Object> m = new HashMap();

        m.put("code",code);
        m.put("status","error");
        m.put("message",message);

        return m;
    }

    public static Map fail(String message){
        Map<String,Object> m = new HashMap();

        m.put("code",502);
        m.put("status","error");
        m.put("message",message);

        return m;
    }
}
